package com.x.ioc_03;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

/**
 * ClassName: UserController
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.09.03 0:12
 */

@Controller
public class UserController {

    @Autowired(required = true) //<property id="userService" class="...">
    @Qualifier(value = "newUserServiceImpl")//指定注入哪个Service实现类
    private UserService userService;

    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    public void show(){
        userService.show();
    }
}
